import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
// import { rules } from '/@/utils/helper/validator';
// import { render } from '/@/utils/common/renderUtils';
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '样品类型',
    align: "center",
    dataIndex: 'samType',
    width: 95
  },
  {
    title: '样品编号',
    align: "center",
    dataIndex: 'samNum',
    width: 110
  },
  {
    title: '样品名称',
    align: "center",
    dataIndex: 'samName',
    width: 130
  },
  {
    title: '规格型号',
    align: "center",
    dataIndex: 'model',
    width: 100
  },
  {
    title: '产品批号',
    align: "center",
    dataIndex: 'lotNum',
    width: 100
  },
  {
    title: '取样日期',
    align: "center",
    dataIndex: 'samDate',
    width: 100,
    customRender: ({ text }) => {
      return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
    },
  },
  {
    title: '样品量 (g/kg/mL/L)',
    align: "center",
    dataIndex: 'samQuality',
    width: 110
  },
  {
    title: '样品外观',
    align: "center",
    dataIndex: 'samAppear',
    width: 100
  },
  {
    title: '领样日期',
    align: "center",
    dataIndex: 'outDate',
    width: 100
  },
  {
    title: '领样人',
    align: "center",
    dataIndex: 'outPerson',
    width: 100
  },
  {
    title: '回收日期',
    align: "center",
    dataIndex: 'backDate',
    width: 100
  },
  {
    title: '存样周期',
    align: "center",
    dataIndex: 'stockCycle',
    width: 90
  },
  //  {
  //   title: '委托单位名称',
  //   align:"center",
  //   dataIndex: 'entName_dictText',
  //   width:180
  //  },
  //  {
  //   title: '经办日期',
  //   align:"center",
  //   dataIndex: 'handlDate',
  //   width:100
  //  },
  //  {
  //   title: '样品大类',
  //   align:"center",
  //   dataIndex: 'sampleType',
  //  },
  //  {
  //   title: '样品类别',
  //   align:"center",
  //   dataIndex: 'sampleSort',
  //  },
  // {
  //   title: '报告编号',
  //   align: "center",
  //   dataIndex: 'reportCode',
  //   width: 120
  // },
  {
    title: '样品状态',
    align: "center",
    dataIndex: 'samStatus',
    width: 90
  },
  {
    title: '委托主键ID',
    align: "center",
    dataIndex: 'entrustId',
    ifShow: false
  },
];

//列表数据
export const samColumns: BasicColumn[] = [
  {
    title: '样品类型',
    align: "center",
    dataIndex: 'samType',
    width: 140
  },
  {
    title: '样品编号',
    align: "center",
    dataIndex: 'samNum',
    width: 140
  },
  {
    title: '样品名称',
    align: "center",
    dataIndex: 'samName',
    width: 140
  },
  {
    title: '规格型号',
    align: "center",
    dataIndex: 'model',
    width: 100
  },
  {
    title: '产品批号',
    align: "center",
    dataIndex: 'lotNum',
    width: 100
  },
  {
    title: '取样日期',
    align: "center",
    dataIndex: 'samDate',
    width: 100,
    customRender: ({ text }) => {
      return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text)
    },
  },
  {
    title: '样品量 (g/kg/mL/L)',
    align: "center",
    dataIndex: 'samQuality',
    width: 130
  },
  {
    title: '样品外观',
    align: "center",
    dataIndex: 'samAppear',
    width: 110
  },
  {
    title: '回收日期',
    align: "center",
    dataIndex: 'backDate',
    width: 110
  },
  {
    title: '存样周期',
    align: "center",
    dataIndex: 'stockCycle',
    width: 100
  },
  {
    title: '样品状态',
    align: "center",
    dataIndex: 'samStatus',
    width: 100
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "样品编号",
    field: 'samNum',
    component: 'JInput',
    colProps: { span: 6 },
  },
  {
    label: "样品名称",
    field: 'samName',
    component: 'JInput',
    colProps: { span: 6 },
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '委托单位名称',
    field: 'entName',
    component: 'JDictSelectTag',
  },
  {
    label: '经办日期',
    field: 'handlDate',
    component: 'Input',
  },
  {
    label: '样品大类',
    field: 'sampleType',
    component: 'JDictSelectTag',
  },
  {
    label: '样品类别',
    field: 'sampleSort',
    component: 'JDictSelectTag',
  },
  {
    label: '检测项目',
    field: 'testItems',
    component: 'JSelectMultiple',
  },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];
//子表列表数据
export const labItemsColumns: BasicColumn[] = [
  {
    title: '大类名称',
    align: "center",
    dataIndex: 'bigTypeName'
  },
  {
    title: '类别名称',
    align: "center",
    dataIndex: 'midTypeName'
  },
  {
    title: '实验项目名称',
    align: "center",
    dataIndex: 'itemName'
  },
  {
    title: '依据的标准名称',
    align: "center",
    dataIndex: 'basisName'
  },
  {
    title: '依据的标准编号',
    align: "center",
    dataIndex: 'basisNum'
  },
  // {
  //   title: '限制范围',
  //   align: "center",
  //   dataIndex: 'basisScope'
  // },
  {
    title: '依据附件',
    align: "center",
    dataIndex: 'basisAtta',
    width: 130,
    slots: { customRender: 'fileSlot' },
  },

  // {
  //   title: '班组',
  //   align: "center",
  //   dataIndex: 'team'
  // },
  {
    title: '实验人员',
    align: "center",
    dataIndex: 'testPerson',
    width: 130
  },
  {
    title: '项目状态',
    align: "center",
    dataIndex: 'itemStatus',
    width: 130
  },
  {
    title: '完成时间',
    align: "center",
    dataIndex: 'itemFinishTime',
    width: 130
  },
  {
    title: '委托单ID',
    align: "center",
    dataIndex: 'entrustId',
    width: 180,
    ifShow: false,
  },
];
//子表表格配置
export const labSampleJVxeColumns: JVxeColumn[] = [
  {
    title: '样品名称',
    key: 'samName',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '规格型号',
    key: 'model',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '产品批号',
    key: 'lotNum',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '取样日期',
    key: 'samDate',
    type: JVxeTypes.date,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '样品量 (g/kg/mL/L)',
    key: 'samQuality',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '样品外观',
    key: 'samAppear',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '其他说明',
    key: 'remark',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '样品编号',
    key: 'samNum',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '委托主键ID',
    key: 'entrustId',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
]

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
